home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / Events.p < prev    next >
Encoding:
Text File  |  1996-05-04  |  8.4 KB  |  320 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Events.p
  3.  
  4.      Contains:    Event Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1.3
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT Events;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __EVENTS__}
  30. {$SETC __EVENTS__ := 1}
  31.  
  32. {$I+}
  33. {$SETC EventsIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$IFC UNDEFINED __QUICKDRAW__}
  43. {$I Quickdraw.p}
  44. {$ENDC}
  45. {    MixedMode.p                                                    }
  46. {    QuickdrawText.p                                                }
  47.  
  48. {$IFC UNDEFINED __OSUTILS__}
  49. {$I OSUtils.p}
  50. {$ENDC}
  51. {    Memory.p                                                    }
  52.  
  53. {$PUSH}
  54. {$ALIGN MAC68K}
  55. {$LibExport+}
  56.     
  57. TYPE
  58.     EventKind = UInt16;
  59.  
  60.  
  61. CONST
  62.     nullEvent                    = 0;
  63.     mouseDown                    = 1;
  64.     mouseUp                        = 2;
  65.     keyDown                        = 3;
  66.     keyUp                        = 4;
  67.     autoKey                        = 5;
  68.     updateEvt                    = 6;
  69.     diskEvt                        = 7;
  70.     activateEvt                    = 8;
  71.     osEvt                        = 15;
  72.     kHighLevelEvent                = 23;
  73.  
  74.     
  75. TYPE
  76.     EventMask = UInt16;
  77.  
  78.  
  79. CONST
  80.     mDownMask                    = $0002;                        { mouse button pressed }
  81.     mUpMask                        = $0004;                        { mouse button released }
  82.     keyDownMask                    = $0008;                        { key pressed }
  83.     keyUpMask                    = $0010;                        { key released }
  84.     autoKeyMask                    = $0020;                        { key repeatedly held down }
  85.     updateMask                    = $0040;                        { window needs updating }
  86.     diskMask                    = $0080;                        { disk inserted }
  87.     activMask                    = $0100;                        { activate/deactivate window }
  88.     highLevelEventMask            = $0400;                        { high-level events (includes AppleEvents) }
  89.     osMask                        = $8000;                        { operating system events (suspend, resume) }
  90.     everyEvent                    = $FFFF;                        { all of the above }
  91.  
  92. { event message equates }
  93.     charCodeMask                = $000000FF;
  94.     keyCodeMask                    = $0000FF00;
  95.     adbAddrMask                    = $00FF0000;
  96.     osEvtMessageMask            = $FF000000;
  97. { OS event messages.  Event (sub)code is in the high byte of the message field. }
  98.     mouseMovedMessage            = $00FA;
  99.     suspendResumeMessage        = $0001;
  100.     resumeFlag                    = 1;                            { Bit 0 of message indicates resume vs suspend }
  101.     convertClipboardFlag        = 2;                            { Bit 1 in resume message indicates clipboard change }
  102.  
  103.     
  104. TYPE
  105.     EventModifiers = UInt16;
  106.  
  107.  
  108. CONST
  109. { modifiers }
  110.     activeFlag                    = $0001;                        { Bit 0 of modifiers for activateEvt and mouseDown events }
  111.     btnState                    = $0080;                        { Bit 7 of low byte is mouse button state }
  112.     cmdKey                        = $0100;                        { Bit 0 of high byte }
  113.     shiftKey                    = $0200;                        { Bit 1 of high byte }
  114.     alphaLock                    = $0400;                        { Bit 2 of high byte }
  115.     optionKey                    = $0800;                        { Bit 3 of high byte }
  116.     controlKey                    = $1000;                        { Bit 4 of high byte }
  117.     rightShiftKey                = $2000;                        { Bit 5 of high byte }
  118.     rightOptionKey                = $4000;                        { Bit 6 of high byte }
  119.     rightControlKey                = $8000;                        { Bit 7 of high byte }
  120.     activeFlagBit                = 0;                            { activate? (activateEvt and mouseDown) }
  121.     btnStateBit                    = 7;                            { state of button? }
  122.     cmdKeyBit                    = 8;                            { command key down? }
  123.     shiftKeyBit                    = 9;                            { shift key down? }
  124.     alphaLockBit                = 10;                            { alpha lock down? }
  125.     optionKeyBit                = 11;                            { option key down? }
  126.     controlKeyBit                = 12;                            { control key down? }
  127.     rightShiftKeyBit            = 13;                            { right shift key down? }
  128.     rightOptionKeyBit            = 14;                            { right Option key down? }
  129.     rightControlKeyBit            = 15;                            { right Control key down? }
  130.  
  131.  
  132. TYPE
  133.     EventRecord = RECORD
  134.         what:                    EventKind;
  135.         message:                UInt32;
  136.         when:                    UInt32;
  137.         where:                    Point;
  138.         modifiers:                EventModifiers;
  139.     END;
  140.  
  141.     KeyMap = PACKED ARRAY [0..127] OF BOOLEAN;
  142.  
  143.     EvQEl = RECORD
  144.         qLink:                    QElemPtr;
  145.         qType:                    INTEGER;
  146.         evtQWhat:                EventKind;                                { this part is identical to the EventRecord as... }
  147.         evtQMessage:            UInt32;                                    { defined above }
  148.         evtQWhen:                UInt32;
  149.         evtQWhere:                Point;
  150.         evtQModifiers:            EventModifiers;
  151.     END;
  152.  
  153.     EvQElPtr = ^EvQEl;
  154.  
  155.     GetNextEventFilterProcPtr = ProcPtr;  { PROCEDURE GetNextEventFilter(VAR theEvent: EventRecord; VAR result: BOOLEAN); }
  156.     GetNextEventFilterUPP = UniversalProcPtr;
  157.  
  158. CONST
  159.     uppGetNextEventFilterProcInfo = $000000BF; { SPECIAL_CASE_PROCINFO( kSpecialCaseGNEFilterProc ) }
  160.  
  161. FUNCTION NewGetNextEventFilterProc(userRoutine: GetNextEventFilterProcPtr): GetNextEventFilterUPP;
  162.     {$IFC NOT GENERATINGCFM }
  163.     INLINE $2E9F;
  164.     {$ENDC}
  165.  
  166. PROCEDURE CallGetNextEventFilterProc(VAR theEvent: EventRecord; VAR result: BOOLEAN; userRoutine: GetNextEventFilterUPP);
  167.     {$IFC NOT GENERATINGCFM}
  168.     {To be implemented:  Glue to move parameters according to special case conventions.}
  169.     {$ENDC}
  170.     
  171. TYPE
  172.     GNEFilterUPP = GetNextEventFilterUPP;
  173.  
  174.     FKEYProcPtr = ProcPtr;  { PROCEDURE FKEY; }
  175.     FKEYUPP = UniversalProcPtr;
  176.  
  177. CONST
  178.     uppFKEYProcInfo = $00000000; { PROCEDURE ; }
  179.  
  180. FUNCTION NewFKEYProc(userRoutine: FKEYProcPtr): FKEYUPP;
  181.     {$IFC NOT GENERATINGCFM }
  182.     INLINE $2E9F;
  183.     {$ENDC}
  184.  
  185. PROCEDURE CallFKEYProc(userRoutine: FKEYUPP);
  186.     {$IFC NOT GENERATINGCFM}
  187.     INLINE $205F, $4E90;
  188.     {$ENDC}
  189. FUNCTION GetCaretTime : UInt32;
  190.     {$IFC NOT CFMSYSTEMCALLS}
  191.     INLINE $2EB8, $02F4;            { MOVE.l $02F4,(SP) }
  192.     {$ENDC}
  193.  
  194. PROCEDURE SetEventMask( value: EventMask );
  195.     {$IFC NOT CFMSYSTEMCALLS}
  196.     INLINE $31DF, $0144;            { MOVE.w (SP)+,$0144 }
  197.     {$ENDC}
  198.  
  199. FUNCTION GetEventMask : EventMask;
  200.     {$IFC NOT CFMSYSTEMCALLS}
  201.     INLINE $3EB8, $0144;            { MOVE.w $0144,(SP) }
  202.     {$ENDC}
  203.  
  204. FUNCTION GetEvQHdr: QHdrPtr;
  205.     {$IFC NOT GENERATINGCFM}
  206.     INLINE $2EBC, $0000, $014A;
  207.     {$ENDC}
  208. { InterfaceLib exports GetEvQHdr, so make GetEventQueue map to that }
  209. FUNCTION GetDblTime : UInt32;
  210.     {$IFC NOT CFMSYSTEMCALLS}
  211.     INLINE $2EB8, $02F0;            { MOVE.l $02F0,(SP) }
  212.     {$ENDC}
  213.  
  214. { InterfaceLib exports GetDblTime, so make GetDoubleClickTime map to that }
  215. FUNCTION GetNextEvent(eventMask: EventMask; VAR theEvent: EventRecord): BOOLEAN;
  216.     {$IFC NOT GENERATINGCFM}
  217.     INLINE $A970;
  218.     {$ENDC}
  219. FUNCTION WaitNextEvent(eventMask: EventMask; VAR theEvent: EventRecord; sleep: UInt32; mouseRgn: RgnHandle): BOOLEAN;
  220.     {$IFC NOT GENERATINGCFM}
  221.     INLINE $A860;
  222.     {$ENDC}
  223. FUNCTION EventAvail(eventMask: EventMask; VAR theEvent: EventRecord): BOOLEAN;
  224.     {$IFC NOT GENERATINGCFM}
  225.     INLINE $A971;
  226.     {$ENDC}
  227. PROCEDURE GetMouse(VAR mouseLoc: Point);
  228.     {$IFC NOT GENERATINGCFM}
  229.     INLINE $A972;
  230.     {$ENDC}
  231. FUNCTION Button: BOOLEAN;
  232.     {$IFC NOT GENERATINGCFM}
  233.     INLINE $A974;
  234.     {$ENDC}
  235. FUNCTION StillDown: BOOLEAN;
  236.     {$IFC NOT GENERATINGCFM}
  237.     INLINE $A973;
  238.     {$ENDC}
  239. FUNCTION WaitMouseUp: BOOLEAN;
  240.     {$IFC NOT GENERATINGCFM}
  241.     INLINE $A977;
  242.     {$ENDC}
  243. PROCEDURE GetKeys(theKeys: KeyMap);
  244.     {$IFC NOT GENERATINGCFM}
  245.     INLINE $A976;
  246.     {$ENDC}
  247. FUNCTION KeyTranslate(transData: UNIV Ptr; keycode: UInt16; VAR state: UInt32): UInt32;
  248.     {$IFC NOT GENERATINGCFM}
  249.     INLINE $A9C3;
  250.     {$ENDC}
  251. FUNCTION TickCount: UInt32;
  252.     {$IFC NOT GENERATINGCFM}
  253.     INLINE $A975;
  254.     {$ENDC}
  255. FUNCTION PostEvent(eventNum: EventKind; eventMsg: UInt32): OSErr;
  256.     {$IFC NOT GENERATINGCFM}
  257.     INLINE $201F, $305F, $A02F, $3E80;
  258.     {$ENDC}
  259. FUNCTION PPostEvent(eventCode: EventKind; eventMsg: UInt32; VAR qEl: EvQElPtr): OSErr;
  260.     {$IFC NOT GENERATINGCFM}
  261.     INLINE $225F, $201F, $305F, $A12F, $2288, $3E80;
  262.     {$ENDC}
  263. FUNCTION OSEventAvail(mask: EventMask; VAR theEvent: EventRecord): BOOLEAN;
  264.     {$IFC NOT GENERATINGCFM}
  265.     INLINE $205F, $301F, $A030, $5240, $1E80;
  266.     {$ENDC}
  267. FUNCTION GetOSEvent(mask: EventMask; VAR theEvent: EventRecord): BOOLEAN;
  268.     {$IFC NOT GENERATINGCFM}
  269.     INLINE $205F, $301F, $A031, $5240, $1E80;
  270.     {$ENDC}
  271. PROCEDURE FlushEvents(whichMask: EventMask; stopMask: EventMask);
  272.     {$IFC NOT GENERATINGCFM}
  273.     INLINE $201F, $A032;
  274.     {$ENDC}
  275. PROCEDURE SystemClick({CONST}VAR theEvent: EventRecord; theWindow: WindowRef);
  276.     {$IFC NOT GENERATINGCFM}
  277.     INLINE $A9B3;
  278.     {$ENDC}
  279. PROCEDURE SystemTask;
  280.     {$IFC NOT GENERATINGCFM}
  281.     INLINE $A9B4;
  282.     {$ENDC}
  283. FUNCTION SystemEvent({CONST}VAR theEvent: EventRecord): BOOLEAN;
  284.     {$IFC NOT GENERATINGCFM}
  285.     INLINE $A9B2;
  286.     {$ENDC}
  287. {$IFC OLDROUTINENAMES }
  288.  
  289. CONST
  290.     networkEvt                    = 10;
  291.     driverEvt                    = 11;
  292.     app1Evt                        = 12;
  293.     app2Evt                        = 13;
  294.     app3Evt                        = 14;
  295.     app4Evt                        = 15;
  296.     networkMask                    = $0400;
  297.     driverMask                    = $0800;
  298.     app1Mask                    = $1000;
  299.     app2Mask                    = $2000;
  300.     app3Mask                    = $4000;
  301.     app4Mask                    = $8000;
  302.  
  303.  
  304. FUNCTION KeyTrans(transData: UNIV Ptr; keycode: UInt16; VAR state: UInt32): UInt32;
  305.     {$IFC NOT GENERATINGCFM}
  306.     INLINE $A9C3;
  307.     {$ENDC}
  308. {$ENDC}
  309.  
  310. {$ALIGN RESET}
  311. {$POP}
  312.  
  313. {$SETC UsingIncludes := EventsIncludes}
  314.  
  315. {$ENDC} {__EVENTS__}
  316.  
  317. {$IFC NOT UsingIncludes}
  318.  END.
  319. {$ENDC}
  320.